const urlKYXContent = 'ECI/WeChatSmallProgram/WeChat_Base.ashx?AppKey=049BD15C6FC04BD80808A601DC46E50515CBEEA33FB29AB4'; 
const urlKYXContents = '/ECI/EnglishCornerApplet/EnglishCornerApplet_Base.ashx?AppKey=049BD15C6FC04BD80808A601DC46E50515CBEEA33FB29AB4'
//kouyuxiu/IES_base.ashx
// var urlKYXContent = 'ECI/kouyuxiu/IES_base.ashx?AppKey=049BD15C6FC04BD80808A601DC46E50515CBEEA33FB29AB4'; 
const urlWJWContent = 'ECI/waijiao/User_Base.ashx?AppKey=049BD15C6FC04BD80808A601DC46E50515CBEEA33FB29AB4';
const urlYTBContent = 'ECI/TOEFL_IEITS/TO_IE_Base.ashx?AppKey=049BD15C6FC04BD80808A601DC46E50515CBEEA33FB29AB4';
const urlXCXContent = 'ECI/xiaochengxu/IES_base.ashx?AppKey=049BD15C6FC04BD80808A601DC46E50515CBEEA33FB29AB4';
const urlShanBContent = 'https://api.shanbay.com/bdc/search/';

// const urlKYXContents = '/ECI/EnglishCornerApplet/EnglishCornerApplet_Base.ashx?AppKey=049BD15C6FC04BD80808A601DC46E50515CBEEA33FB29AB4'

var wxRequest = (params, url) => {
    wx.request({
        url,
        method: params.method || 'GET',
        data: params.dataDic || {},
        header: {
            Accept: 'application/json',
            'content-type': params.contentType || 'application/json',
        },
        success: (res) => {
            if (params.success) {
                params.success(res);
            }
        },
        fail: (res) => {
            if (params.fail) {
                params.fail(res);
            }
        },
        complete: (res) => {
            console.log('本次网络请求的url:', url)
            console.log('本次网络请求发送的数据:', params.dataDic)
            if (params.complete) {
                params.complete(res);
            }
        },
    });
};

//获取你可能感兴趣的视频
var methodUnvoicedVideoByCategoryId = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=UnvoicedVideoByCategoryId`);
}

//口语配音获取首页数据
var methodGetWechatIndexPage = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetWechatIndexPage`);
}

//口语配音选择视频进入练习
var methodWechatStartLearning  = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatStartLearning `);
}

//口语配音获取视频信息和字幕
var methodWechatGetVideoInfo = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatGetVideoInfo`);
}

//口语练习页面加载获取练习语句
var methodGetIndexPracticeSentence = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetIndexPracticeSentence`);
}
//获取指定练习语句
var methodGetAssignPracticeSentence = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetAssignPracticeSentence`);
}
//随机切换练习语句
var methodGetRandomPracticeSentence = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetRandomPracticeSentence`);
}
//开始学习接口(未点评测时：先上传用户信息)
var methodWechatDailyVoiceStartLearning = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatDailyVoiceStartLearning`);
}
//开始学习接口(点击评测时：上传录音等)
var methodSubmitDailyVoiceInfo = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=SubmitDailyVoiceInfo`);
}
//获取排行榜信息
var methodGetDailyVoiceRankListInfo = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetDailyVoiceRankListInfo`);
}
//添加播放次数
var methodAddPlayNum = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=AddPlayNum`);
}
//获取难点词汇
var methodGetDifficultWords = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetDifficultWords`);
}

//获取小程序二维码
var methodGetWxaCode = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetWxaCode`);
}

// 获取微信openid
var methodRequestWechatAPI = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=RequestWechatAPI`);
};

// 发送用户注册验证码
var methodWechatGetSMSCode = (params) => {
    /*********** 接口统一使用微信小程序虚拟路径 */
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatGetSMSCode`);
    /***********/
};

// 用户注册
var methodWechatRegester = (params) => {
    /*********** 接口统一使用微信小程序虚拟路径 */
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatRegester`);
    /***********/
};



// 提交录音获取分数 
var methodWechatSumbitMyVoice = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatSumbitMyVoice`);
};

// 获取排行榜数据
var methodGetRankingList = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetRankingList`);
};

// 用户登录
var methodWechatLogin = (params) => {
    /*********** 接口统一使用微信小程序虚拟路径 */
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatLogin`);
    /***********/
};

// 根据日期选择获取练习记录
var methodGetUserLearningRecords = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetUserLearningRecords`);
};

// 点赞他人的练习
var methodWeiXinUserPointPraise = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WeiXinUserPointPraise`);
};

// 获取用户录音文件
var methodGetUserVoice = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetUserVoice`);
};

// 获取accessToken 
var methodGetWechatToken = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetWechatToken`);
};



// 获取用户分数和信息
var methodWechatGetUserScoreAndVideoInfo = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatGetUserScoreAndVideoInfo`);
};



// 接收formId
var methodSendFormId = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=SendFormId`);
};

// 发送消息模板
var methodSendTemplateMessage = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=SendTemplateMessage`);
};


/*********** 新增换一换接口 */
// 首页换一换
var methodChangeOneChange = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=ChangeOneChange`);
};
/***********/

// 获取网络图片接口
var methodGetBannerAndActivityRules = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetBannerAndActivityRules`);
};

// 查询单词获取详情
var methodGetWordDetail = (params) => {
    wxRequest(params, `${urlShanBContent}`);
};
// 单词添加到单词本
var methodAddToWordBook = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=AddToWordBook`);
};
// 单词移出单词本
var methodRemoveToWordBook = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=RemoveToWordBook`);
};
// 获取单词本列表
var methodGetWordBookList = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=GetWordBookList`);
};
// 提交单词录音
var methodWechatSumbitWordVoice = (params) => {
    wxRequest(params, `${getApp().globalData.apiUrl}/${urlKYXContent}&action=WechatSumbitWordVoice`);
};
//商城列表
var methodEnglishCorner_CommodityList = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_CommodityList`);
};

//商品详情
var methodEnglishCorner_CommodityInfo = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_CommodityInfo`);
};
//商品购买
var methodEnglishCorner_CommodityTransaction = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_CommodityTransaction`);
};
//我的订单
var methodEnglishCorner_MyOrder = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_MyOrder`);
};

//获取用户信息
var methodEnglishCorner_MyPersonalInformation = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_MyPersonalInformation`);
};
//修改用户资料
var methodEnglishCorner_UpPersonalInformation = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_UpPersonalInformation`);

};
//授权页面获取登录验证码
var methodEnglishCorner_LoginVerificationCode = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_LoginVerificationCode`);
};

//授权页面获取注册验证码
var methodEnglishCorner_RegisterVerificationCode = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_RegisterVerificationCode`);
};

//授权页面不注册保存手机号
var methodEnglishCorner_Recording = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_Recording`);
};



//授权页面获取登录验证码
var methodEnglishCorner_LoginVerificationCode = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_LoginVerificationCode`);
};

//授权页面获取注册验证码
var methodEnglishCorner_RegisterVerificationCode = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_RegisterVerificationCode`);
};

//授权页面不注册保存手机号
var methodEnglishCorner_Recording = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_Recording`);
};


//授权页面验证码授权
var methodEnglishCorner_LoginByVerificationCode = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_LoginByVerificationCode`);
};

//授权页面验证码注册
var methodEnglishCorner_Register = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_Register`);
};

//重新授权是否为VIP
var methodEnglishCorner_NotVIPAuthorization = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_NotVIPAuthorization`);
};
//首页领取任务
var methodEnglishCorner_Task = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_Task`);
};
//记录登录任务
var methodEnglishCorner_RecordLanding = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_RecordLanding`);
};
//列表领取任务
var methodEnglishCorner_ReceiveTask = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_ReceiveTask`);
};
//记录任务
var methodEnglishCorner_RecordingTask = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_RecordingTask`);
};
//获取用户资料
var methodEnglishCorner_MyPersonalInformation = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_MyPersonalInformation`);
};
//首页任务小红点
var methodEnglishCorner_HomeIndex = (params) => {
  wxRequest(params, `${getApp().globalData.apiUrll}/${urlKYXContents}&action=EnglishCorner_HomeIndex`);
};


module.exports = {
    //你可能感兴趣的视频
    methodUnvoicedVideoByCategoryId,
    //口语配音获取首页数据
    methodGetWechatIndexPage,
    //口语配音选择视频进入练习
    methodWechatStartLearning,
    //口语配音获取视频信息和字幕
    methodWechatGetVideoInfo,
    //口语练习页面加载获取练习语句
    methodGetIndexPracticeSentence,
    //获取指定练习语句
    methodGetAssignPracticeSentence,
    //随机切换练习语句
    methodGetRandomPracticeSentence,
    
    methodWechatDailyVoiceStartLearning,
    methodSubmitDailyVoiceInfo,
    methodGetDailyVoiceRankListInfo,
    methodAddPlayNum,
    methodGetDifficultWords,
    methodRequestWechatAPI,
    methodWechatGetSMSCode,
    methodWechatRegester,
    methodWechatSumbitMyVoice,
    methodGetRankingList,
    methodWechatLogin,
    methodGetUserLearningRecords,
    methodWeiXinUserPointPraise,
    methodGetUserVoice,
    methodGetWechatToken,
    methodWechatGetUserScoreAndVideoInfo,
    methodSendFormId,
    methodSendTemplateMessage,
    methodGetWxaCode,
    /*********** 新增换一换接口 */
    methodChangeOneChange,
    /***********/
    methodGetBannerAndActivityRules,
    /** 新增单词查询 */
    methodGetWordDetail,
    methodAddToWordBook,
    methodRemoveToWordBook,
    methodGetWordBookList,
    methodWechatSumbitWordVoice,
    /** 商城列表 **/
    methodEnglishCorner_CommodityList,

    /**商品详情**/
    methodEnglishCorner_CommodityInfo,
    /****商品购买 */
    methodEnglishCorner_CommodityTransaction,
    /****我的订单 */
    methodEnglishCorner_MyOrder,
  // 获取用户信息
  methodEnglishCorner_MyPersonalInformation,
  //修改用户资料
  methodEnglishCorner_UpPersonalInformation,
  //授权页面获取登录验证码
  methodEnglishCorner_LoginVerificationCode,
  //授权页面获取注册验证码
  methodEnglishCorner_RegisterVerificationCode,
  //授权页面不注册保存手机号
  methodEnglishCorner_Recording,
  //授权页面验证码授权
  methodEnglishCorner_LoginByVerificationCode,
  //授权页面验证码注册
  methodEnglishCorner_Register,
  //重新授权是否为VIP
  methodEnglishCorner_NotVIPAuthorization,

    // 获取用户信息
    methodEnglishCorner_MyPersonalInformation,
    //修改用户资料
    methodEnglishCorner_UpPersonalInformation,
    //授权页面获取登录验证码
    methodEnglishCorner_LoginVerificationCode,
    //授权页面获取注册验证码
    methodEnglishCorner_RegisterVerificationCode,
    //授权页面不注册保存手机号
    methodEnglishCorner_Recording,
    //授权页面验证码授权
    methodEnglishCorner_LoginByVerificationCode,
    //授权页面验证码注册
    methodEnglishCorner_Register,
    //重新授权是否为VIP
    methodEnglishCorner_NotVIPAuthorization,

    
    //首页领取任务
   methodEnglishCorner_Task,

  //首页任务登录
  methodEnglishCorner_RecordLanding,
  //列表领取任务
  methodEnglishCorner_ReceiveTask,
  //记录任务
  methodEnglishCorner_RecordingTask,
  //获取用户资料
  methodEnglishCorner_MyPersonalInformation,    
//首页小红点
  methodEnglishCorner_HomeIndex,
  
    

};